<?php
  class CRegisterScript extends CWidget {
      
      public $functionName;
      public $params=array();
      
      public function run()  {          
          switch ($this->functionName) {
              case "registerJqueryTreeView" : $this->registerJqueryTreeView();
                                            break;
							case "registerJqxTree" : $this->registerJqxTree();
                                            break;
              case "registerJqueryTimePicker" : $this->registerJqueryTimePicker();
                                            break;
              case "registerSketch" : $this->registerSketch();
                                            break;
              default : break;                                                                                                                                        
          }
    }
         

      public function registerJqueryTreeView() {
         $basePath=Yii::getPathOfAlias('application.extensions.jquery.treeview');
         $baseUrl = Yii::app()->getAssetManager()->publish($basePath);        
                  
         Yii::app()->clientScript->registerCssFile($baseUrl . '/jquery.treeview.css');  
         Yii::app()->clientScript->registerCoreScript('jquery');
         Yii::app()->clientScript->registerScriptFile($baseUrl . '/jquery.treeview.js',CClientScript::POS_HEAD); 
      }
			
			public function registerJqxTree() {
         $basePath=Yii::getPathOfAlias('application.extensions.bootstrap.jqwidgets');
         $baseUrl = Yii::app()->getAssetManager()->publish($basePath);        
                  
         Yii::app()->clientScript->registerCssFile($baseUrl . '/styles/jqx.base.css');  
         Yii::app()->clientScript->registerCoreScript('jquery');
         Yii::app()->clientScript->registerScriptFile($baseUrl . '/jqxcore.js',CClientScript::POS_HEAD);
				 Yii::app()->clientScript->registerScriptFile($baseUrl . '/jqxtree.js',CClientScript::POS_HEAD);
      }
      
      public function registerJqueryTimePicker() {
         $basePath=Yii::getPathOfAlias('application.extensions.jquery');
         $baseUrl = Yii::app()->getAssetManager()->publish($basePath);        
                  
         Yii::app()->clientScript->registerCssFile($baseUrl . '/timepicker/jquery-ui-timepicker-addon.css');
         Yii::app()->clientScript->registerCssFile($baseUrl . '/jui/jquery/css/base/jquery-ui.css');
         Yii::app()->clientScript->registerCssFile($baseUrl . '/jui/jquery/css/base/jquery.ui.core.css');
         Yii::app()->clientScript->registerCssFile($baseUrl . '/jui/jquery/css/base/jquery.ui.datepicker.css');
         Yii::app()->clientScript->registerCssFile($baseUrl . '/jui/jquery/css/base/jquery.ui.slider.css');
         Yii::app()->clientScript->registerCoreScript('jquery');
         Yii::app()->clientScript->registerScriptFile($baseUrl . '/jui/jquery/js/ui.core.js',CClientScript::POS_HEAD);
         Yii::app()->clientScript->registerScriptFile($baseUrl . '/jui/jquery/js/ui.datepicker.js',CClientScript::POS_HEAD);
         Yii::app()->clientScript->registerScriptFile($baseUrl . '/jui/jquery/js/ui.slider.js',CClientScript::POS_HEAD);
				 Yii::app()->clientScript->registerScriptFile($baseUrl . '/timepicker/jquery-ui-timepicker-addon.js',CClientScript::POS_HEAD);
      }
      
      public function registerSketch() {
         $basePath=Yii::getPathOfAlias('application.extensions.jquery.sketch');
         $baseUrl = Yii::app()->getAssetManager()->publish($basePath);
         Yii::app()->clientScript->registerCoreScript('jquery');
         Yii::app()->clientScript->registerScriptFile($baseUrl . '/sketch.js',CClientScript::POS_HEAD);
      }
			
    }
?>
